package jsyf.oa.web.report;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.report.TransmitReportFacade;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Api(value = "微信转发报表接口", description = "微信转发报表接口")
@Controller
@RequestMapping("/reportTransmit")
public class TransmitReportController {


    @Resource
    private TransmitReportFacade transmitReportFacade;

    @RequestMapping(value = "/group.json", method = RequestMethod.POST)
    public void getGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
//        JSONObject jsonParams = FastJsonConvert.convertJSONToObject(jsonData, JSONObject.class);
//        String userId = jsonParams.getString("userId");
        JSONObject result = new JSONObject();
        List<JSONObject> records = this.transmitReportFacade.getGroupFrontLine();
        result.put("records", records);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(result));
    }
}
